<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2019/2/23 0023
 * Time: 22:35
 */

namespace app\Lib\Ioc\User;


use app\Lib\Model\User\UserLogin;
use app\Lib\Model\User\WebUserLogin;
use think\Db;

class AdminLogin
{
    public function run($data){
        return Db::transaction(function ()use($data){
            $model = (new UserLogin());
            $model->setPassword($data['password']);
            $model->setAccount($data['account']);
            $model->setLoginIp($data['loginIp']);
            $result = $model->run();
            return $result;
        });
    }

    public function webLogin($data){
        return Db::transaction(function ()use($data){
            $model = (new WebUserLogin());
            $model->setAccount($data['openId']);
            $model->setLoginIp($data['loginIp']);
            $result = $model->run();
            return $result;
        });
    }
}